/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* 工具栏样式 */
.toolbar {
    padding: 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between; /* 确保元素分布在两端 */
    align-items: center;
    position: relative; /* 为绝对定位的子元素提供参考 */
}

.toolbar .current-time {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #4a5568; /* 深灰色 */
    font-size: 0.95em;
    font-weight: 500;
}

.week-selector {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid #cbd5e1;
    background: white;
    font-size: 1rem;
    cursor: pointer;
}

/* 课表容器样式 */
.course-table {
    width: 100%;
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    background: #f0f8ff;
    border-radius: 0.5rem;
    overflow: hidden;
}

.header-cell {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: white;
    padding: 1rem;
    text-align: center;
    position: relative;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
}

.semester-info {
    font-size: 1.2em;
    font-weight: 500;
}


.weekday-header th {
    background: #d4e6ff;
    padding: 12px;
    text-align: center;
    border-right: 1px solid #dee2e6;
}

.time-column {
    background: #c1d9ff;
    width: 60px;
}

/* 课程单元格样式 */
.course-cell {
    position: relative;
    height: 5rem;
    border: 1px solid #e2e8f0;
    background: #f0f8ff;
    transition: all 0.2s;
    padding: 2px;
}

.course-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.course-block {
    position: absolute;
    width: calc(100% - 4px);
    height: calc(100% - 4px);
    border-radius: 0.375rem;
    padding: 0.5rem;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-size: 0.875rem;
}

.course-block:hover {
    transform: scale(1.02);
    z-index: 2;
}

.course-info {
    pointer-events: none;
    line-height: 1.3;
}

.course-name {
    font-weight: 500;
    font-size: 0.9em;
    white-space: normal; /* 允许换行 */
    overflow: visible; /* 显示全部内容 */
    text-overflow: clip; /* 不裁剪文本 */
    text-align: center; /* 居中显示 */
}

.course-location {
    font-size: 0.75em;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center; /* 居中显示 */
}

/* 响应式设计 */
@media (max-width: 768px) {
    .course-table {
        margin: 10px;
    }
    
    .weekday-header th {
        padding: 8px;
        font-size: 0.9em;
    }
    
    .course-cell {
        height: 60px;
    }
}

/* 为返回按钮添加样式 */
#backButton {
    padding: 10px 20px;
    background-color: #dc3545; /* 红色背景 */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    position: absolute; /* 添加绝对定位 */
    top: 10px; /* 距离顶部的距离 */
    right: 10px; /* 距离右侧的距离 */
}

#backButton:hover {
    background-color: #c82333; /* 鼠标悬停时的背景颜色 */
}

/* 课程信息模态框样式 */
/* 模态框容器样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}


/* 模态框内容样式 */
.modal-content {
    background-color: white;
    margin: 10vh auto;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 50%;
    max-width: 600px;
    animation: modalFadeIn 0.3s ease-out;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#confirmButton {
    display: block;
    margin: 20px auto; /* 上下外边距为20px，左右自动，实现居中 */
    padding: 10px 20px;
    background-color: #007BFF; /* 蓝色背景 */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#confirmButton:hover {
    background-color: #0056b3; /* 鼠标悬停时颜色变深 */
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1024px) {
    .modal-content {
        width: 70%;
    }
}

@media (max-width: 768px) {
    .course-cell {
        height: 4rem;
    }
    
    .modal-content {
        width: 90%;
        padding: 1.5rem;
    }
}

@media (max-width: 640px) {
    .course-name {
        font-size: 0.75rem;
    }
    
    .course-location {
        display: none;
    }
}

/* 模态框样式优化 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    margin: 5vh auto;
    padding: 0;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.2);
    width: 60%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.4s ease-out;
    border: 1px solid rgba(255,255,255,0.2);
}

.modal-header {
    padding: 24px 30px;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: white;
    border-radius: 16px 16px 0 0;
    position: relative;
    text-align: center;
}

.modal-header h2 {
    margin: 15px 0 10px;
    font-size: 1.8rem;
    font-weight: 600;
}

.course-icon {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 24px;
}

.course-tags {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.course-tags span {
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.modal-body {
    padding: 25px 30px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.info-item:hover {
    background: rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.info-item i {
    font-size: 1.2rem;
    color: #3b82f6;
    width: 30px;
    height: 30px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-item label {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 4px;
}

.info-item .info-value {
    font-weight: 500;
    color: #1f2937;
    font-size: 0.95rem;
}

.course-description {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid #3b82f6;
}

.course-description h3 {
    font-size: 1rem;
    color: #3b82f6;
    margin-bottom: 10px;
}

.course-description p {
    font-size: 0.9rem;
    color: #4b5563;
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 20px 30px;
    border-top: 1px solid #e5e7eb;
}

#confirmButton {
    padding: 12px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

#confirmButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.secondary-btn {
    padding: 12px 24px;
    background: white;
    color: #3b82f6;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.secondary-btn:hover {
    background: rgba(59, 130, 246, 0.05);
    transform: translateY(-2px);
}

.close {
    position: absolute;
    right: 25px;
    top: 25px;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close:hover {
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .modal-content {
        width: 75%;
    }
}

@media (max-width: 768px) {
    .modal-content {
        width: 85%;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .modal-content {
        width: 95%;
        margin: 2vh auto;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    #confirmButton, .secondary-btn {
        width: 100%;
        justify-content: center;
    }
}